package com.sinux.generality.basesupport.utils.kafka.consumer;

import org.apache.kafka.clients.consumer.ConsumerRecords;

import java.time.Duration;
import java.util.Collection;
import java.util.Map;

public interface KafkaConsumerInterface<K, V> {

    ConsumerRecords<K, V> poll(Collection topic);

    ConsumerRecords<K, V> poll(Collection topic,int pollTime) ;

    ConsumerRecords<K, V> poll(Collection topic, Duration duration);

//手动提交offset
    ConsumerRecords<K, V> pollNotAutoCommitdefault(Collection topic);

//手动提交offset
    ConsumerRecords<K, V> pollNotAutoCommitdefault(Collection topic,int pollTime) ;

//手动提交offset
    ConsumerRecords<K, V> pollNotAutoCommitdefault(Collection topic, Duration duration);

//手动提交partition的offset
    ConsumerRecords<K, V> pollNotAutoCommitPartitiondefault(Collection topic, Duration duration);

    void commitSync(Collection<String> topic);

    void commitSync(Collection<String> topic,Map<K, V> singletonMap);

    void close();
}
